﻿//----------------------------------------------------------------------------------------------------------------------
// <copyright file="Events.cs" company="Keith B. Rimington">
//
//   Copyright (c) 2011 Keith B. Rimington
//
//   Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
//     documentation files (the "Software"), to deal in the Software without restriction, including without limitation
//     the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
//     to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
//   The above copyright notice and this permission notice shall be included in all copies or substantial portions of
//     the Software.
//
//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
//     THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
//     CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
//     DEALINGS IN THE SOFTWARE.
//
// </copyright>
//----------------------------------------------------------------------------------------------------------------------

namespace Noc.Pomodoro.Core
{
    using System.Diagnostics.CodeAnalysis;
    using System.Windows;
    using Noc.Pomodoro.ViewModels;

    /// <summary>
    /// Enumerates supported operations in task-related events.
    /// </summary>
    public enum TaskOp
    {
        /// <summary>
        /// Indicates a task was inserted.
        /// </summary>
        Insert,

        /// <summary>
        /// Indicates a task has been updated.
        /// </summary>
        Update,

        /// <summary>
        /// Indicates a pomodoro belonging to a task was started.
        /// </summary>
        StartPomodoro,

        /// <summary>
        /// Indicates a pomodoro belonging to a task was interrupted (internal).
        /// </summary>
        InterruptPomodoroInt,

        /// <summary>
        /// Indicates a pomodoro belonging to a task was interrupted (external).
        /// </summary>
        InterruptPomodoroExt,

        /// <summary>
        /// Indicates a pomodoro belonging to a task was voided.
        /// </summary>
        VoidPomodoro,
    }

    /// <summary>
    /// Event args for events related to pomodoros.
    /// </summary>
    [SuppressMessage("Microsoft.StyleCop.CSharp.MaintainabilityRules", "SA1402:FileMayOnlyContainASingleClass", Justification = "Ignored.")]
    public class PomodoroEventArgs : RoutedEventArgs
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="PomodoroEventArgs"/> class.
        /// </summary>
        public PomodoroEventArgs()
            : base()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="PomodoroEventArgs"/> class.
        /// </summary>
        /// <param name="routedEvent">The routed event identifier for this instance of the <see cref="T:System.Windows.RoutedEventArgs"/> class.</param>
        public PomodoroEventArgs(RoutedEvent routedEvent)
            : base(routedEvent)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="PomodoroEventArgs"/> class.
        /// </summary>
        /// <param name="routedEvent">The routed event identifier for this instance of the <see cref="T:System.Windows.RoutedEventArgs"/> class.</param>
        /// <param name="source">An alternate source that will be reported when the event is handled. This pre-populates the <see cref="P:System.Windows.RoutedEventArgs.Source"/> property.</param>
        public PomodoroEventArgs(RoutedEvent routedEvent, object source)
            : base(routedEvent, source)
        {
        }

        /// <summary>
        /// Gets or sets the affected pomodoro.
        /// </summary>
        /// <value>
        /// The affected pomodoro.
        /// </value>
        public PomodoroViewModel Pomodoro { get; set; }
    }

    /// <summary>
    /// Event args for events related to tasks.
    /// </summary>
    [SuppressMessage("Microsoft.StyleCop.CSharp.MaintainabilityRules", "SA1402:FileMayOnlyContainASingleClass", Justification = "Ignored.")]
    public class TaskEventArgs : RoutedEventArgs
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="TaskEventArgs"/> class.
        /// </summary>
        public TaskEventArgs()
            : base()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="TaskEventArgs"/> class.
        /// </summary>
        /// <param name="routedEvent">The routed event identifier for this instance of the <see cref="T:System.Windows.RoutedEventArgs"/> class.</param>
        public TaskEventArgs(RoutedEvent routedEvent)
            : base(routedEvent)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="TaskEventArgs"/> class.
        /// </summary>
        /// <param name="routedEvent">The routed event identifier for this instance of the <see cref="T:System.Windows.RoutedEventArgs"/> class.</param>
        /// <param name="source">An alternate source that will be reported when the event is handled. This pre-populates the <see cref="P:System.Windows.RoutedEventArgs.Source"/> property.</param>
        public TaskEventArgs(RoutedEvent routedEvent, object source)
            : base(routedEvent, source)
        {
        }

        /// <summary>
        /// Gets or sets the affected task.
        /// </summary>
        /// <value>
        /// The affected task.
        /// </value>
        public TaskViewModel Task { get; set; }

        /// <summary>
        /// Gets or sets a value indicating which operation took place on the task.
        /// </summary>
        /// <value>
        /// An indicator of the operation that took place on the task.
        /// </value>
        public TaskOp Operation { get; set; }
    }
}